package com.token.iot.bratterycharging.gateway.sender;

import java.util.Map;

import org.springframework.stereotype.Component;

import com.outstanding.framework.core.Logger;
import com.outstanding.framework.core.PendingException;
import com.outstanding.framework.log.LoggerFactory;
import com.token.iot.bratterycharging.gateway.AbstractSender;
import com.token.iot.bratterycharging.gateway.ChannelHandlerContextManager;
import com.token.iot.bratterycharging.gateway.Sender;
import com.token.iot.bratterycharging.gateway.utils.ByteUtil;

import io.netty.channel.ChannelHandlerContext;

/**
 * 重启
 * @author chenzhixuan
 *
 */
@Component("ABTSender")
public class ABTSender extends AbstractSender{
	
	
	
	
	private static ChannelHandlerContextManager manager = new ChannelHandlerContextManager();
	
	private static Logger loger = LoggerFactory.getLogger(ABTSender.class);
	
	@Override
	public Object send(String imei,Map<String,String> params)  throws PendingException {
		 //查找对应的HandlerContext
		ChannelHandlerContext context = manager.getChannelHandlerContextByImei(imei);
		String sessionid = "000000";
		String command = code+sessionid+"/";
		byte[] c = ByteUtil.addFlag(command.getBytes());
		context.writeAndFlush(c);
		
		return null;
		
	}
}
